feat: customize output format#23
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for customizing the output format of logged return values through a new output parameter in the #[logcall] macro. Users can now specify custom format strings for return values or suppress them entirely by providing an empty string. The implementation follows the same patterns as the existing input parameter for customizing input formatting.
Key changes:
- Added
output_formatfield to all Args enum variants and associated parsing logic - Modified
gen_logfunction to conditionally include return value based on format string content - Changed default log level from "info" to "debug" (unrelated to output formatting feature)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/lib.rs | Core implementation: added output_format parameter handling, updated gen_log to support custom output formats, changed default log level to "debug" |
| tests/ui/ok/output.rs | Added compilation tests for custom output format (" output = {}") and suppressed output ("") |
| examples/main.rs | Added examples demonstrating custom output format (": {:?}") and omitted output ("") |
| README.md | Updated documentation with new output customization examples and refreshed sample output with current timestamps |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else { | ||
| Ok(Args::Simple { | ||
| level: simple_level.unwrap_or_else(|| "info".to_string()), | ||
| level: simple_level.unwrap_or_else(|| "debug".to_string()), |
There was a problem hiding this comment.
The default log level has been changed from "info" to "debug". While this change is reflected in the documentation, it represents a behavioral change that is not directly related to the stated purpose of this PR (customizing output format). This could be a breaking change for users who rely on the default "info" level. Consider either reverting this change and making it part of a separate PR, or explicitly documenting this breaking change in the PR description.
| level: simple_level.unwrap_or_else(|| "debug".to_string()), | |
| level: simple_level.unwrap_or_else(|| "info".to_string()), |
Closes #18